home *** CD-ROM | disk | FTP | other *** search
- /* $VER: AddUser.thor v1.2 (20.12.94)
- *
- * by Magne Østlyngen
- *
- * Adds the sender of the current message to the user database.
- */
-
- options results
-
- p = ' ' || address() || ' ' || show('P',,)
- thorport = pos(' THOR.',p)
-
- if thorport > 0 then thorport = word(substr(p,thorport+1),1)
- else
- do
- say 'No THOR port found!'
- exit 10
- end
-
- if ~show('p', 'BBSREAD') then do
- address command
- "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
- "WaitForPort BBSREAD"
- end
-
- address(thorport)
-
-
- CURRENTMSG STEM msg
- if rc~=0 then do
- REQUESTNOTIFY '"CURRENTMSG failed: '||THOR.LASTERROR||'"' '"_Ok"'
- exit
- end
-
- address BBSREAD
- READBRMESSAGE '"'||msg.bbsname||'"' '"'||msg.confname||'"' msg.msgnr HEADSTEM head
- if rc~=0 then do
- address(thorport)
- REQUESTNOTIFY '"READBRMESSAGE failed: '||BBSREAD.LASTERROR||'"' '"_Ok"'
- exit
- end
-
- if head.fromaddr = 'HEAD.FROMADDR' then head.fromaddr = ""
-
- address(thorport)
-
- REQUESTSTRING 'TITLE="Enter Name:" BT="_Ok|_Cancel" ID="'||head.fromname||'" MAXCHARS=100'
- if rc = 0 then head.fromname = result
-
- REQUESTSTRING 'TITLE="Enter Address:" BT="_Ok|_Cancel" ID="'||head.fromaddr||'" MAXCHARS=100'
- if rc = 0 then head.fromaddr = result
-
- wbu.comment.1 = ""
- REQUESTSTRING 'TITLE="Enter Comment:" BT="_Ok|_Cancel" MAXCHARS=100'
- if rc = 0 then wbu.comment.1 = result
-
- wbu.alias = ""
- REQUESTSTRING 'TITLE="Enter Alias:" BT="_Ok|_Cancel" MAXCHARS=100'
- if rc = 0 then wbu.alias = result
-
- REQUESTNOTIFY '"Name : '||head.fromname||'\nAddr : '||head.fromaddr||'\nComnt: '||wbu.comment.1||'\nAlias: '||wbu.alias||'\n\nAdd this user?"' '"_Yes|_No"'
- if rc~=0 then do
- REQUESTNOTIFY '"REQUESTNOTIFY failed: '||THOR.LASTERROR||'"' '"_Ok"'
- exit
- end
- if result~=0 then do
- wbu.name = head.fromname
- wbu.address = head.fromaddr
- if wbu.comment.1 = "" then wbu.comment.count = 0; else wbu.comment.count = 1
-
- address BBSREAD
- WRITEBRUSER '"'||msg.bbsname||'"' STEM wbu ONLYIFEXIST
- if rc~=0 then do
- address(thorport)
- REQUESTNOTIFY '"WRITEBRUSER failed: '||BBSREAD.LASTERROR||'"' '"_Ok"'
- exit
- end
- end
-
- exit
-